class Father {
    constructor(x,y) {
        this.x = x;
        this.y = y
    }

    sum() {
        console.log(this.x+this.y)
    }
}

class Son extends Father {
    constructor(x,y) {
        // super 必须在子类的this前调用
        super(x,y)
        this.x = x;
        this.y = y;
    }
    sub() {
        console.log(this.x - this.y)
    }
}

var son1 = new Son(5,1)
son1.sub()
son1.sum()